﻿using Natural.Attributes;
using Natural.Managers;
using Natural.Model;
using Natural.Providers;

namespace Natural.Actions.DeviceNetwork
{
    [Impl(Type= ImplType.Action , Name = "Update", Strategy = "Default", ApplyTo = typeof(Party), Version = 1, Priority = 3)]
    public class UpdateParty : Update<Party>
    {        
        public override void Execute(ActionContext context,Party entity, string includes)
        {
            Data.Update<Party>(entity, includes);
        }
    }
    [Impl(Type = ImplType.Action, Name = "Update", Strategy = "Organization", ApplyTo = typeof(Party), Version = 1, Priority = 2)]
    public class UpdateOrganization : UpdateParty
    {
        public virtual bool IsValid(ActionContext context,Party entity, string includes)
        {
            return entity.TypeId == 1;
        }
        public override void Execute(ActionContext context,Party entity, string includes)
        {
            base.Execute(context,entity, includes);
        }
    }
    [Impl(Type = ImplType.Action, Name = "Update", Strategy = "Individual", ApplyTo = typeof(Party), Version = 1, Priority = 1)]
    public class UpdateIndividual : UpdateParty
    {
        public virtual bool IsValid(ActionContext context, Party entity, string includes)
        {
            return entity.TypeId == 2;
        }
        public override void Execute(ActionContext context, Party entity, string includes)
        {
            base.Execute(context,entity, includes);
        }
    }


    

}
